package com.candoit.webapps.pricing.bean.validator;

import javax.faces.application.FacesMessage;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.validator.Validator;
import javax.faces.validator.ValidatorException;

@ManagedBean(name = "doublevalidator")
@ViewScoped
public class DoubleValidator implements Validator {
	
	public void validate(FacesContext context, UIComponent component,
			Object value) throws ValidatorException {
		 if (!(value instanceof Double)) {
	            throw new ValidatorException(new FacesMessage("Debe ingresar un valor de dos decimales"));
	        }

	}

}
